<script setup lang="ts">
import {ref} from 'vue'
import {StnIpt, IptTypeConst} from 'st-ui-vue3-navie'
import {ResponsiveCollapseSearch} from '@components'
import {MenuObjPropNameEnum} from '@menu'
import {useSysMenuStore} from '../stores/sys-menu-store.ts'
import {MenuSearchFormDefault} from '../consts/menu-search-form-default.ts'
import {MenuIptPropsPathEnum} from '../enums/menu-ipt-props-path-enum.ts'

// 菜单搜索表单
const menuSearchForm = ref({...MenuSearchFormDefault})

const searchHandler = async (searchFormData: Record<string, any>) => {
  return await useSysMenuStore().getTableDataByReq(searchFormData)
}
</script>

<template>
  <div class="menu-search">
    <ResponsiveCollapseSearch
      v-model:search-form="menuSearchForm"
      :search-form-default="MenuSearchFormDefault"
      :search-handler="searchHandler"
    >
      <n-gi>
        <StnIpt
          v-model:value.number="menuSearchForm[MenuObjPropNameEnum.ID]"
          :predefine-props="MenuIptPropsPathEnum.ID"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.NAME]"
          :predefine-props="MenuIptPropsPathEnum.NAME"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.TYPE]"
          :type="IptTypeConst.SELECT"
          :predefine-props="MenuIptPropsPathEnum.TYPE"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.PAGE_PATH]"
          :predefine-props="MenuIptPropsPathEnum.PAGE_PATH_INPUT"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.ROUTE_NAME]"
          :predefine-props="MenuIptPropsPathEnum.ROUTE_NAME"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.ROUTE_PATH]"
          :predefine-props="MenuIptPropsPathEnum.ROUTE_PATH"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.DISABLED]"
          :type="IptTypeConst.SELECT"
          :predefine-props="MenuIptPropsPathEnum.DISABLED_SELECT"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.HIDDEN]"
          :type="IptTypeConst.SELECT"
          :predefine-props="MenuIptPropsPathEnum.HIDDEN_SELECT"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.CACHED]"
          :type="IptTypeConst.SELECT"
          :predefine-props="MenuIptPropsPathEnum.CACHED_SELECT"
        />
      </n-gi>
      <n-gi>
        <StnIpt
          v-model:value="menuSearchForm[MenuObjPropNameEnum.LABELED]"
          :type="IptTypeConst.SELECT"
          :predefine-props="MenuIptPropsPathEnum.LABELED_SELECT"
        />
      </n-gi>
    </ResponsiveCollapseSearch>
  </div>
</template>

<style scoped>

</style>
